<?php

namespace app\admin\controller\device;

use think\facade\Db;
use app\common\controller\Backend;

class Ledscree extends Backend
{

    protected $noNeedLogin      = ['index'];//生成土壤墒情测试数据

    public function initialize()
    {
        parent::initialize();
        //$this->model = new WeacherDeviceDataModel();
    }


    /**
     * Led设备列表
     */
    public function index()
    {
        $page = $this->request->param('page');
        $status = $this->request->param('status','');
        $name = $this->request->param('name','');

        $where = [];
        if (!empty($status)) {
            $where[] = ['status','=',$status];
        }
        if (!empty($name)) {
            $where[] = ['name','like','%'.$name.'%'];
        }

        $monitorList = Db::name('park_ledscree')->where($where)->page($page,10)->select();
        $count = Db::name('park_ledscree')->where($where)->count();
        $this->success('请求成功',['list'=>$monitorList,'count'=>$count]);
    }

    /**
     * 节目列表
     */
    public function programList()
    {
        $page = $this->request->param('page');
        $status = $this->request->param('status','');
        $name = $this->request->param('name','');

        $where = [];
        if (!empty($status)) {
            $where[] = ['status','=',$status];
        }
        if (!empty($name)) {
            $where[] = ['name','like','%'.$name.'%'];
        }

        $monitorList = Db::name('park_led_programs')->where($where)->page($page,10)->select();
        $count = Db::name('park_led_programs')->where($where)->count();
        $this->success('请求成功',['list'=>$monitorList,'count'=>$count]);
    }
}